package co.wizardattack.model;

import java.io.IOException;
import org.andengine.entity.sprite.Sprite;
import org.andengine.opengl.texture.TextureManager;
import org.andengine.opengl.texture.TextureOptions;
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlasTextureRegionFactory;
import org.andengine.opengl.texture.region.ITextureRegion;
import org.andengine.opengl.vbo.VertexBufferObjectManager;
import android.content.Context;

public class Scenary {
	
	/**
	 * Constantes
	 */	
	private final String CONS_IMAGE_PATH = "images/";
	private final String CONS_IMAGE_SCENARY = "escenario.png";
	private final int CONS_ATLAS_WIDTH = 1080;
	private final int CONS_ATLAS_HEIGTH = 720;

	/**
	 * Atributos
	 */
	private int posX = 1080 / 2;
	private int posY = 720 / 2;
	private BitmapTextureAtlas atlasScenary;
	private ITextureRegion texturaScenary;
	private Sprite spriteScenary;
	
	/**
	 * Constructor
	 */
	public Scenary() {
	}
	
	/**
	 * Metodos
	 */
	public void onCreateResuercesScenary(TextureManager textureManager, Context context) throws IOException {
		BitmapTextureAtlasTextureRegionFactory.setAssetBasePath(CONS_IMAGE_PATH);
		atlasScenary = new BitmapTextureAtlas(textureManager, CONS_ATLAS_WIDTH,CONS_ATLAS_HEIGTH, TextureOptions.DEFAULT);
		texturaScenary = BitmapTextureAtlasTextureRegionFactory.createFromAsset(atlasScenary, context, CONS_IMAGE_SCENARY,0, 0);
		atlasScenary.load();
	}

	public void onCreateSceneScenary(VertexBufferObjectManager vertexBufferObjectManager) {
		spriteScenary = new Sprite(posX, posY, texturaScenary, vertexBufferObjectManager);
	}
	
	public Sprite getSpriteScenary() {
		return spriteScenary;
	}
}